﻿<%@ Page Title="Search Result" Language="vb" MasterPageFile="~/Site.Master" AutoEventWireup="false"
    CodeBehind="SearchResult.aspx.vb" Inherits="task3.SearchResult" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <h2>
        Search Result
    </h2>

    <h4>Deals</h4>
    <asp:ListView ID="ListView1" runat="server" DataKeyNames="ID" 
        DataSourceID="AccessDataSource1">
        
        <EmptyDataTemplate>
            <span>No deals found.</span>
        </EmptyDataTemplate>
        
        <ItemTemplate>
        
        
        <a class="" href="/detail.aspx?dealid=<%# Eval("ID") %>"><%# Eval("DealName")%>
        </a><br />
            <asp:Label ID="RequestedbyLabel" runat="server" 
                Text='<%# Eval("DealDescription").ToString() %>' />
            <br />
<br />
        </ItemTemplate>
        
    </asp:ListView>

    
    <br /><br />
    <h4>Deal Request</h4>
    <asp:ListView ID="ListView2" runat="server" DataKeyNames="ID" 
        DataSourceID="AccessDataSource2">
        
        <EmptyDataTemplate>
            <span>No deal request found.</span>
        </EmptyDataTemplate>
        
        <ItemTemplate>
        
        
        <a class="" href="/dealrequestdetail.aspx?id=<%# Eval("ID") %>"><%# Eval("Title")%>
        </a><br />
            <asp:Label ID="description" runat="server" 
                Text='<%# Eval("Description").ToString() %>' />
            <br />
<br />
        </ItemTemplate>
        
    </asp:ListView>
    
    
    <br /><br />
    <h4>Reviews</h4>
    <asp:ListView ID="ListView3" runat="server" DataKeyNames="ID" 
        DataSourceID="AccessDataSource3">
        
        <EmptyDataTemplate>
            <span>No reviews found.</span>
        </EmptyDataTemplate>
        
        <ItemTemplate>
        
        
        <a class="" href="/reviewdetail.aspx?id=<%# Eval("ID") %>"><%# Eval("Title")%>
        </a><br />
            <asp:Label ID="description" runat="server" 
                Text='<%# Eval("content").ToString() %>' />
            <br />
<br />
        </ItemTemplate>
        
    </asp:ListView>
    <p>
        <asp:AccessDataSource ID="AccessDataSource1" runat="server" 
            DataFile="~/App_Data/DealsDb.accdb" 
            SelectCommand="SELECT * FROM [DealDetail] WHERE (([DealDescription] LIKE '%' + ? + '%') OR ([Dealname] LIKE '%' + ? + '%'))">
            <SelectParameters>
                <asp:QueryStringParameter Name="?" QueryStringField="q" />
                <asp:QueryStringParameter Name="?" QueryStringField="q" />
            </SelectParameters>
        </asp:AccessDataSource>
        <asp:AccessDataSource ID="AccessDataSource2" runat="server" 
            DataFile="~/App_Data/DealsDb.accdb" 
            SelectCommand="SELECT * FROM [DealRequest] WHERE (([Description] LIKE '%' + ? + '%') OR ([Title] LIKE '%' + ? + '%'))">
            <SelectParameters>
                <asp:QueryStringParameter Name="?" QueryStringField="q" />
                <asp:QueryStringParameter Name="?" QueryStringField="q" />
            </SelectParameters>
        </asp:AccessDataSource>
        <asp:AccessDataSource ID="AccessDataSource3" runat="server" 
            DataFile="~/App_Data/DealsDb.accdb" 
            SelectCommand="SELECT * FROM [Review] WHERE (([content] LIKE '%' + ? + '%') OR ([title] LIKE '%' + ? + '%'))">
            <SelectParameters>
                <asp:QueryStringParameter Name="?" QueryStringField="q" />
                <asp:QueryStringParameter Name="?" QueryStringField="q" />
            </SelectParameters>
        </asp:AccessDataSource>
    </p>
</asp:Content>
